package require wt::database::drivers::tclOdbc::base

namespace eval ::wt::database::drivers::tclOdbc::sqlServer:: {
  variable base ::wt::database::drivers::tclOdbc::base
}

proc ::wt::database::drivers::tclOdbc::sqlServer::executeFile {dataSource path} {
  upvar $dataSource ds

  set f [open $path]
  set buf [read $f]
  set ptn "(.*?)(?:^|\n)go(?:\n|\$)"
  set conn [table get $ds connection]

  foreach {str stmt} [regexp -inline -all -- $ptn $buf] {
    puts "<p>Executing SQL: \"$stmt\".</p>\n"
    flush stdout
    $conn $stmt
  }
}

package provide wt::database::drivers::tclOdbc::sqlServer 1
